#include <io.h>
#include <stdio.h>
#include <limits.h>
#include <windows.h>

#include <string>
using namespace std;

#include "captor.h"

#include "../../../common/isignal.h"
#include "../../../common/imutex.h"

#define PRE_BUF_NUM  2
#define PRE_BUF_SIZE 1024

struct IFilePackHeader {
	unsigned char  type;
	unsigned char  numb;
	unsigned short size;
};

struct IFilePackage {
	IFilePackHeader hdr;
	char* buf;
};

class CapFileWin32 : public Captor
{
public:
	CapFileWin32();
	~CapFileWin32();

	virtual int CaptorInit();
	virtual int CaptorStart();
	virtual int CaptorStop();
	virtual int GetCaptorData(void* data);

private:
	int CaptorSubDir(wstring path);
	int CaptorFile(wstring filename);

private:
	ISignal      isignal_[PRE_BUF_NUM];
	IFilePackage ifilepack_[PRE_BUF_NUM];

	unsigned char  usingbufnum_;
	unsigned int   fileinfosize_;
};